package com.bootdo.system.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bootdo.system.dao.BaseMapper;
import com.github.pagehelper.PageHelper;

@Service
public class BaseService<T> {

	@Autowired
	BaseMapper<T> baseMapper;
	
	public T get(Class<T> c,Long id){
		return baseMapper.get(c,id);
	}

	public List<T> list(T t,int pageNum, int pageSize, String orderBy){
		PageHelper.startPage(pageNum, pageSize);
		return baseMapper.list(t, orderBy);
	}

	public int save(T obj) {
		
		return baseMapper.save(obj);
	}

	public int update(T obj) {
		
		return baseMapper.update(obj);
	}

	public int delete(Class<T> c,Long id) {
		return baseMapper.delete(c, id);
	}

}
